import com.jfinal.kit.HttpKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.lsk.util.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class QueryYJF {

    /**
     * 查询卡签名
     *
     * @param parameters
     * @return
     */
    public static String querySign(Map<String, String> parameters) {


        String sign = "userAccount" + parameters.get("userAccount")
                + "orderId" + parameters.get("orderId") + "key" + "hKcMNaDXh5r5XYmGZ5QGtMa45Nc57D84";

        System.out.println(UtilUrlEncode.URLDecoderString(sign));

        sign = MD5.md5(UtilUrlEncode.URLDecoderString(sign));

        return sign;

    }

    public static void main(String[] args) {
        String appId = "18388869888";

        String appSert = "hKcMNaDXh5r5XYmGZ5QGtMa45Nc57D84";

        String cardSubmitUrl = "http://api.douleka.com:11140/api/singleSupply";


        String cardQueryUrl = "http://api.douleka.com:11140/supply/apiQuerySupplyCard";
        try {


            Map<String, String> parameters = new HashMap<>();

            parameters.put("userAccount", appId);


            parameters.put("orderId", "XK20190525214128822690");

            String sign = querySign(parameters);

            parameters.put("sign", sign);//加密签名，加密原文请参考下面的加密拼接，MD5加密

            System.out.println(JsonUtil.getJsonStr(parameters));

            String result = HttpKit.get(cardQueryUrl, parameters);
            Map<String,Object> map=JsonUtil.getMapFromJsonObjStr(result);
            String status=map.get("status").toString();
            Syslog.info(status);
            /*更新卡信息*/




    } catch(
    Exception e)

    {

        Syslog.error(e);

    }

}
}
